<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>编辑考核页面</title>
	<link rel="stylesheet" type="text/css" href="../Styles/admin-all.css" />
    <link rel="stylesheet" type="text/css" href="../Styles/base.css" />
    <link rel="stylesheet" type="text/css" href="../Styles/bootstrap-3.3.7-dist/css/bootstrap.min.css" />
	<link rel="stylesheet" type="text/css" href="../Styles/bootstrap-3.3.7-dist/css/bootstrap-theme.min.css" />
    <script type="text/javascript" src="../Scripts/jquery.min.js"></script>
    <script type="text/javascript" src="../Styles/bootstrap-3.3.7-dist/js/bootstrap.min.js"></script>
    <script type="text/javascript" src="../Styles\laypage\laypage.js"></script>
    <script language="javascript" type="text/javascript" src="../Styles/My97DatePicker/WdatePicker.js"></script>
    <link href="../Styles/My97DatePicker/skin/WdatePicker.css" rel="stylesheet" type="text/css">
    <style type="text/css">
    	#contract{
    		width: 80%;
    		height: 60%;
    		margin: auto;
    		margin-top: 30px;
    	}
    </style>
</head>
<body>


<div id="contract">
	<form action="updateApp" method="post">
		<input type="hidden" name="ar_id" value="${appUserDept.ar_id }">
		<table class="table" border="#cccccc solid 1px";>
			<thead>
				<tr><th><img alt="" src="../img/update.png" style="padding-bottom: 10px"><span style="font-size: 20px">人事合同信息编辑</span></th><th style="float: right;"><< <a href="../Template/showContract.jsp">返回上一级</a></th></tr>
			</thead>
			<tbody>
				<tr><td class="TableContent" width="10%" style="border-right:#cccccc solid 1px;"> 考核人：<font color="#FF0000" title="打*号表示为必填">(*)</font></td>
				<td width="80%"><input type="text" name="user" id="user" style="background-color:#F5F5F5;color:#006600;" value="${appUserDept.ar_appuser }" readonly="">
				<input type="hidden" name="userid" id="userid" value="">
				</td></tr>
				
				<tr><td style="border-right:#cccccc solid 1px;">考核编号：<font color="#FF0000" title="打*号表示为必填">(*)</font></td>
				<td class="TableData"><input type="text" name="number" class="BigInput" id="con_num" size="40" value="${appUserDept.ar_num }" readonly=""></td>
				</tr>
				
				<tr><td style="border-right:#cccccc solid 1px;">考核名称：<font color="#FF0000" title="打*号表示为必填">(*)</font></td>
				<td class="TableData"><input type="text" name="ar_name" class="BigInput" size="40" value="${appUserDept.ar_name }" readonly=""></td>
				</tr>
				
				<tr><td nowrap="" class="TableContent" style="border-right:#cccccc solid 1px;"> 考核部门：</td>
				<td class="TableData">
					<input type="hidden" value="${appUserDept.ar_dept_id }" id="type">
					<select name="type" class="BigStatic" id="type1">
						<option value="0">请选择类型</option>		
					</select>
				</td></tr>
				
				<tr><td nowrap="" class="TableContent" style="border-right:#cccccc solid 1px;"> 考核状态：</td>
				<td class="TableData">
					<input type="hidden" value="${appUserDept.ar_status }" id="status">
      				<select name="ckey" class="BigStatic" id="status1">
						<option value="2">请选择状态</option>
						<option value="0">考核未进行</option>
						<option value="1">考核已结束</option>		
					</select>
				</td></tr>
				
				<tr><td nowrap="" class="TableContent" style="border-right:#cccccc solid 1px;"> 发布日期：<font color="#FF0000" title="打*号表示为必填">(*)</font></td>
				<td class="TableData"><input class="BigInput" type="text" value="${appUserDept.ar_issdate }" name="signdate" style="width:168px;" size="20" onclick="WdatePicker({skin:'ext',dateFmt:'yyyy-MM-dd',minDate:'2008-03-08',maxDate:'2100-03-10'})"></td></tr>
				
				<tr>
      				<td nowrap="" class="TableContent" style="border-right:#cccccc solid 1px;"> 考核日期：<font color="#FF0000" title="打*号表示为必填">(*)</font></td>
     				<td class="TableData"><input class="BigInput" type="text" value="${appUserDept.ar_appdate }" name="testdate" style="width:168px;" size="20" onclick="WdatePicker({skin:'ext',dateFmt:'yyyy-MM-dd',minDate:'2008-03-08',maxDate:'2100-03-10'})"></td>
    			</tr>
								
				<tr>
      				<td nowrap="" class="TableContent" style="border-right:#cccccc solid 1px;"> 考核文档：</td>
      				<td class="TableData"><input type="text" id="myfile" name="appendix" readonly="" class="BigInput" style="width:180px;height:22px;line-height:22px;font-size:14px;" value="${appUserDept.ar_enclo }"><a href="javascript:void(0)" id="sc">+附件上传</a></td>
    			</tr>
    			
    			<tr>
      				<td nowrap="" class="TableContent" style="border-right:#cccccc solid 1px;"> 考核合格率：<font color="#FF0000" title="打*号表示为必填">(%)</font></td>
      				<td class="TableData"><input type="text" name="percent" class="BigInput" style="width:180px;height:22px;line-height:22px;font-size:14px;" value="${appUserDept.ar_percent }"></td>
    			</tr>
    			
    			<tr>
      				<td nowrap="" class="TableContent" style="border-right:#cccccc solid 1px;"> 发布人：</td>
      				<td class="TableData"><input type="text" name="appendix" readonly="" class="BigInput" style="width:180px;height:22px;line-height:22px;font-size:14px;" value="${appUserDept.uname }"></td>
    			</tr>
    			
    			<tr>
    				<td nowrap="" class="TableContent" style="border-right:#cccccc solid 1px;line-height: 180px;">备注：<font color="#FF0000" title="打*号表示为必填">(*)</font></td>
    				<td><textarea name="replyContent" style="width: 60%;height: 200px">${appUserDept.ar_remaks }</textarea></td>
    			</tr>
			</tbody>
			<tfoot>
				<tr align="center" class="TableControl">
					<td colspan="2" nowrap=""><input type="submit" value="保存" class="btn btn-primary" id="save"></td>
	 			</tr>
			</tfoot>
		</table>
	</form>
	
	<!-- 模态框（Modal） -->
	<div class="modal fade" id="upload" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
		<div class="modal-dialog">
			<div class="modal-content">
				<div class="modal-header">
					<button type="button" class="close" data-dismiss="modal" aria-hidden="true">
						&times;
					</button>
					<h4 class="modal-title" id="myModalLabel">
						附件上传页面
					</h4>
				</div>
				<form action="../showCon/upload" method="post" enctype="multipart/form-data">
				<div class="modal-body">
					
					<input type="file" name="photo" id="word"/>
				
				</div>
				<div class="modal-footer">  
	                 <button type="button" class="btn btn-default" data-dismiss="modal">返回</button>
	                 <button type="button" class="btn btn-primary" id="btn1">上传</button> 
	            </div>
	            </form> 
			</div><!-- /.modal-content -->
		</div><!-- /.modal -->
	</div>
	
</div>

<script type="text/javascript">
$(function(){
	//查询的部门选择框的显示
	getDept();
	function getDept(){
		$.ajax({
			url:"../showCon/findSec",
			type:"post",
			dataType:"json",
			
			success:function(result){
				console.log(result.sections);
				$("#type1").html("");
				$("#type1").append("<option value='0'>请选择部门</option>")
				 	$.each(result.sections,function(inx,ele){
				 		$("#type1").append(
						"<option value='"+ele.seorid+"'>"+ele.deptname+"</option>"
					 )
				 	})
				 	var type=$("#type").val();
					console.log(type);
					$("#type1").val(type);
			}
		})
	};
	
})


//点击出发上传文件的事件
$(document).on('click','#sc',function(){
	$("#upload").modal("show");
});

//上传按钮的点击事件
$(document).on('click','#btn1',function(){
	var formData = new FormData();
    formData.append("photo", document.getElementById("word").files[0]);
	$.ajax({
		url:"../showCon/upload",
		type:"post",
		data: formData,
        /**
        *必须false才会自动加上正确的Content-Type
        */
        contentType: false,
        /**
        * 必须false才会避开jQuery对 formdata 的默认处理
        * XMLHttpRequest会对 formdata 进行正确的处理
        */
        processData: false,
		
		success:function(result){
			console.log(result);
			$("#upload").modal("hide");
			$("#myfile").val(result.fileName);
		}
	})
});


var status=$("#status").val();
console.log(status);
$("#status1").val(status);




</script>
</body>
</html>